<?php session_start();

require_once("../config/tencent_config.php");
require_once("session.php");

function tencent_login()
{
	$_SESSION['callback_count'] = 0;
	
	$state = md5(uniqid(rand(), TRUE));
	$login_url = "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=" 
		. APP_ID . "&redirect_uri=" . urlencode(CALLBACK)
		. "&state=" . $state . "&scope=".SCOPE;
	
	$_SESSION['state'] = $state;
	
	header("Location:".$login_url);
}

tencent_login();
?>